#include<iostream>
#include<thread>
#include<chrono>

class A{
public:
    virtual ~A(){std::this_thread::sleep_for(std::chrono::seconds(5));}
    virtual void Proc(void) = 0;
};

class B : public A{
public:
    ~B(){}
    virtual void Proc(void) override{
        std::cout<< "B Proc" << std::endl;
    }
};

void Thread1(A* p){
    while (true){
        p->Proc();
        std::this_thread::sleep_for(std::chrono::seconds(1));
    }
}


int main(void)
{
    A* pa = new B;

    std::thread t1(Thread1, pa);
    std::this_thread::sleep_for(std::chrono::seconds(10));

    delete pa;
    t1.join();
}
